# create_openapi_agent

> **Function** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/agent_toolkits/openapi/planner/create_openapi_agent)

Construct an OpenAI API planner and controller for a given spec.

Inject credentials via requests_wrapper.

We use a top-level "orchestrator" agent to invoke the planner and controller,
rather than a top-level planner
that invokes a controller with its plan. This is to keep the planner simple.

You need to set allow_dangerous_requests to True to use Agent with BaseRequestsTool.
Requests can be dangerous and can lead to security vulnerabilities.
For example, users can ask a server to make a request to an internal
server. It's recommended to use requests through a proxy server
and avoid accepting inputs from untrusted sources without proper sandboxing.
Please see: https://python.langchain.com/docs/security
for further security information.

## Signature

```python
create_openapi_agent(
    api_spec: ReducedOpenAPISpec,
    requests_wrapper: RequestsWrapper,
    llm: BaseLanguageModel,
    shared_memory: Optional[Any] = None,
    callback_manager: Optional[BaseCallbackManager] = None,
    verbose: bool = True,
    agent_executor_kwargs: Optional[Dict[str, Any]] = None,
    allow_dangerous_requests: bool = False,
    allowed_operations: Sequence[Operation] = ('GET', 'POST'),
    **kwargs: Any = {},
) -> Any
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `api_spec` | `ReducedOpenAPISpec` | Yes | The OpenAPI spec. |
| `requests_wrapper` | `RequestsWrapper` | Yes | The requests wrapper. |
| `llm` | `BaseLanguageModel` | Yes | The language model. |
| `shared_memory` | `Optional[Any]` | No | Optional. The shared memory. Default is None. (default: `None`) |
| `callback_manager` | `Optional[BaseCallbackManager]` | No | Optional. The callback manager. Default is None. (default: `None`) |
| `verbose` | `bool` | No | Optional. Whether to print verbose output. Default is True. (default: `True`) |
| `agent_executor_kwargs` | `Optional[Dict[str, Any]]` | No | Optional. Additional keyword arguments for the agent executor. (default: `None`) |
| `allow_dangerous_requests` | `bool` | No | Optional. Whether to allow dangerous requests. Default is False. (default: `False`) |
| `allowed_operations` | `Sequence[Operation]` | No | Optional. The allowed operations. Default is ("GET", "POST"). (default: `('GET', 'POST')`) |
| `kwargs` | `Any` | No | Additional arguments. (default: `{}`) |

## Returns

`Any`

The agent executor.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/agent_toolkits/openapi/planner.py#L383)