Middleware for LLMs: Tools Are Instrumental for Language Agents in Complex Environments