# commons > AI Agents for Data Analysis ## Docs ### API Reference #### Main functions > The main agent constructor, plus the building blocks for a commons agent. - [Commons](https://posit-dev.github.io/commons/py/reference/Commons.html): A trustworthy agent that answers questions about its data - [data_source](https://posit-dev.github.io/commons/py/reference/data_source.html): Create a data source from an engine, a pins board, or named frames - [semantic_layer](https://posit-dev.github.io/commons/py/reference/semantic_layer.html): Collect measures into a semantic layer - [measure](https://posit-dev.github.io/commons/py/reference/measure.html): Mark a function as a measure - [context_layer](https://posit-dev.github.io/commons/py/reference/context_layer.html): Create a context layer from text or Markdown files #### Commons Methods > Methods for the Commons class - [Commons.__repr__](https://posit-dev.github.io/commons/py/reference/Commons.__repr__.html) - [Commons.__deepcopy__](https://posit-dev.github.io/commons/py/reference/Commons.__deepcopy__.html) - [Commons.chat](https://posit-dev.github.io/commons/py/reference/Commons.chat.html) - [Commons.stream_async](https://posit-dev.github.io/commons/py/reference/Commons.stream_async.html) - [Commons.chat_async](https://posit-dev.github.io/commons/py/reference/Commons.chat_async.html) - [Commons.stream](https://posit-dev.github.io/commons/py/reference/Commons.stream.html) - [Commons.chat_structured](https://posit-dev.github.io/commons/py/reference/Commons.chat_structured.html) - [Commons.chat_structured_async](https://posit-dev.github.io/commons/py/reference/Commons.chat_structured_async.html) - [Commons.extract_data](https://posit-dev.github.io/commons/py/reference/Commons.extract_data.html) - [Commons.extract_data_async](https://posit-dev.github.io/commons/py/reference/Commons.extract_data_async.html) - [Commons.to_solver](https://posit-dev.github.io/commons/py/reference/Commons.to_solver.html) - [Commons.citation_corpus](https://posit-dev.github.io/commons/py/reference/Commons.citation_corpus.html) - [Commons.prewarm](https://posit-dev.github.io/commons/py/reference/Commons.prewarm.html) - [Commons.add_turn](https://posit-dev.github.io/commons/py/reference/Commons.add_turn.html) - [Commons.set_turns](https://posit-dev.github.io/commons/py/reference/Commons.set_turns.html) - [Commons.queue_restore_reminder](https://posit-dev.github.io/commons/py/reference/Commons.queue_restore_reminder.html) #### Supporting types > The objects the constructors return, and the values they carry. - [DataSource](https://posit-dev.github.io/commons/py/reference/DataSource.html): Tables an agent can query, and the dictionary that describes them - [SemanticLayer](https://posit-dev.github.io/commons/py/reference/SemanticLayer.html): The trusted calculations an agent can run - [ContextLayer](https://posit-dev.github.io/commons/py/reference/ContextLayer.html): Text that helps an agent interpret its data source - [Measure](https://posit-dev.github.io/commons/py/reference/Measure.html): A trusted calculation the agent can run - [Injected](https://posit-dev.github.io/commons/py/reference/Injected.html): Runtime representation of an annotated type - [Tag](https://posit-dev.github.io/commons/py/reference/Tag.html): How an answer was produced - [list_tables](https://posit-dev.github.io/commons/py/reference/list_tables.html): The table names an agent can query on `source` #### DataSource Methods > Methods for the DataSource class - [DataSource.from_frames](https://posit-dev.github.io/commons/py/reference/DataSource.from_frames.html) - [DataSource.from_engine](https://posit-dev.github.io/commons/py/reference/DataSource.from_engine.html) - [DataSource.from_board](https://posit-dev.github.io/commons/py/reference/DataSource.from_board.html) - [DataSource.query](https://posit-dev.github.io/commons/py/reference/DataSource.query.html) - [DataSource.ensure_loaded](https://posit-dev.github.io/commons/py/reference/DataSource.ensure_loaded.html) - [DataSource.dialect](https://posit-dev.github.io/commons/py/reference/DataSource.dialect.html) #### Shiny UI and server > Put a commons agent inside of an interactive chat app. Needs the `shiny` extra. - [ui.app](https://posit-dev.github.io/commons/py/reference/ui.app.html) - [ui.server](https://posit-dev.github.io/commons/py/reference/ui.server.html) - [ui.theme](https://posit-dev.github.io/commons/py/reference/ui.theme.html) - [ui.commons_chat_dependency](https://posit-dev.github.io/commons/py/reference/ui.commons_chat_dependency.html) - [ui.asset_base_url](https://posit-dev.github.io/commons/py/reference/ui.asset_base_url.html)